/*
 * @Copyright: Copyright (c) 2021 andyten
 * @Description: vuex 全局状态
 * @Author: andy.ten@tom.com
 * @Date: 2021-11-03 14:30:39
 * @LastEditors: andy.ten@tom.com
 * @LastEditTime: 2021-11-03 15:49:30
 * @Version: 1.0.1
 */
import Vue from 'vue/dist/vue.esm.js';
import Vuex from 'vuex'

// 使用vuex插件：调用Vuex.install(Vue)方法
Vue.use(Vuex);
const store = new Vuex.Store({
  // 定义全局状态
  state: {
    g_count: 100
  },
  // 定义全局commit的mutation
  mutations: {
    increment(state) {
      state.g_count++
    },
    decrement(state) {
      state.g_count--
    }
  }
});

export default store;